package com.sc.nft.entity.vo.mall;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.sc.nft.enums.MallOrderStatusEnum;
import com.sc.nft.enums.PayMethodEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;

@Data
public class AdminMallPageOrderVO {

    @ApiModelProperty(value = "订单id")
    private Long id;

    @ApiModelProperty(value = "品牌名称")
    private String daoName;

    @ApiModelProperty(value = "商品信息 多个已;隔开的 其他是拼好的 格式: 图片,名称,规格,数量;图片,名称,规格,数量")
    private String products;

    @ApiModelProperty(value = "是否申请了售后 false:否 true:是")
    private Boolean isApplyRefund;

    @ApiModelProperty(value = "订单号")
    private String orderNo;

    /**
     * API订单id
     */
    @ApiModelProperty(value = "API订单id")
    private String apiOrderId;

    /**
     * 订单状态:success：成功，processing：处理中，failed：失败，untreated：未处理
     */
    @ApiModelProperty(value = "充值状态:success：成功，processing：处理中，failed：失败，untreated：未处理")
    private String apiOrderState;

    @ApiModelProperty(value = "快递单号")
    private String deliveryNo;

    @ApiModelProperty(value = "状态  TIMEOUT_CANCEL:超时取消 WAIT_PAY:待付款 WAIT_SEND:待发货 WAIT_RECEIVE:待收货 RECEIVE:已收货 FINISH:已完成")
    private MallOrderStatusEnum status;

    @ApiModelProperty(value = "购买账号")
    private String userTel;

    @ApiModelProperty(value = "订单总金额")
    private String totalPrice;

    @ApiModelProperty(value = "实付金额")
    private String payPrice;

    @ApiModelProperty(value = "支付方式 FAST_PAY:杉德绑卡支付 WALLET_PAY:钱包支付 HF_FAST_PAY:汇付支付")
    private PayMethodEnum payType;

    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date createTime;

    @ApiModelProperty(value = "支付时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date payTime;

    @ApiModelProperty(value = "备注")
    private String adminNote;

    @ApiModelProperty(value = "供应商名称")
    private String supplyName;

    @ApiModelProperty(value = "商品编码")
    private String productCode;

    @ApiModelProperty(value = "发货编码")
    private String sendCode;

    @ApiModelProperty(value = "商品名称")
    private String productName;

    @ApiModelProperty(value = "商品规格名称")
    private String productSpecsName;

    @ApiModelProperty(value = "商品数量")
    private Long productNumber;

    @ApiModelProperty(value = "订单单价")
    private String productSalesPrice;

    @ApiModelProperty(value = "成本单价")
    private String productCostPrice;

    @ApiModelProperty(value = "成本总价")
    private String sumCostPrice;

    @ApiModelProperty(value = "分类名称")
    private String categoryName;

    /**
     * 是否为虚拟商品订单
     */
    @ApiModelProperty(value = "是否为虚拟商品订单")
    private Boolean isVirtual;

    /**
     * 优惠券金额
     */
    @ApiModelProperty(value = "优惠券金额")
    private BigDecimal couponAmount;

    /**
     * 退款金额
     */
    @ApiModelProperty(value = "退款金额")
    private BigDecimal refundPrice;

    /**
     * 退款数量
     */
    @ApiModelProperty(value = "退款数量")
    private BigDecimal refundNum;

    /**
     * 是否已对账
     */
    @ApiModelProperty(value = "是否已对账")
    private Boolean billStatus = false;
    @ApiModelProperty(value = "活动商品规格id")
    private Long activitySpecsId;

    @ApiModelProperty(value = "商品id")
    private Long productId;

    @ApiModelProperty("订单完成时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date finishCreateTime;

    public void setTotalPrice(BigDecimal totalPrice) {
        this.totalPrice = totalPrice.setScale(2,BigDecimal.ROUND_DOWN).toPlainString();
    }

    public void setPayPrice(BigDecimal payPrice) {
        this.payPrice = payPrice.setScale(2,BigDecimal.ROUND_DOWN).toPlainString();
    }

    public void setProductSalesPrice(BigDecimal productSalesPrice) {
        this.productSalesPrice = productSalesPrice.setScale(2,BigDecimal.ROUND_DOWN).toPlainString();
    }
    public void setProductCostPrice(BigDecimal productCostPrice) {
        this.productCostPrice = productCostPrice.setScale(2,BigDecimal.ROUND_DOWN).toPlainString();
    }
    public void setSumCostPrice(BigDecimal sumCostPrice) {
        this.sumCostPrice = sumCostPrice.setScale(2,BigDecimal.ROUND_DOWN).toPlainString();
    }
}
